package com.ljyanimo.config;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;

/**
 * 错误页配置
 * @author Animo
 * @Date 2020/9/30
 * @Blog http://www.ljyanimo.com
 */
@Configuration
public class ErrorPageConfig implements ErrorPageRegistrar {

    @Override
    public void registerErrorPages(ErrorPageRegistry registry) {
        ErrorPage e404 = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
        ErrorPage e403 = new ErrorPage(HttpStatus.FORBIDDEN, "/403.html");
        registry.addErrorPages(e404);
        registry.addErrorPages(e403);
    }
}
